﻿/**
 * \file Menu.xaml.cs
 * \brief Classe Menu.xaml
 * \author ARTUR Vincent
 * \author LAPERDRIX Pierre
 * \version 1.0
 */

namespace WpfJeu
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Shapes;
    using Implem;

    /**
     * \class Menu
     * \brief Menu principal de notre jeu
     */
    public partial class Menu : UserControl
    {
        /**
         * \fn public Menu()
         * \brief Constructeur de Menu
         */
        public Menu()
        {
            InitializeComponent();
        }

        /**
         * \fn private void creation(object sender, RoutedEventArgs e)
         * \brief Affiche le contenu courant de la fenêtre par le menu de création de la partie
         * \param sender
         * \param e
         */
        private void creation(object sender, RoutedEventArgs e)
        {
            //this.Content = new Creation();
            Window.GetWindow(this).Content = new Creation();
        }

        /**
         * \fn private void exit(object sender, RoutedEventArgs e)
         * \brief Quitte le jeu
         * \param sender
         * \param e
         */
        private void exit(object sender, RoutedEventArgs e)
        {
              Application.Current.Shutdown();
        }

        private void load(object sender, RoutedEventArgs e)
        {
             string filename = "";
            // Create OpenFileDialog
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Set filter for file extension and default file extension
            dlg.DefaultExt = ".save";
            dlg.Filter = "Civilisation Save File (.save)|*.save";

            // Display OpenFileDialog by calling ShowDialog method
            Nullable<bool> result = dlg.ShowDialog();
            filename = dlg.FileName;

            // Get the selected file name and display in a TextBox
            if (result == true)
            {
                MainWindow jeu = new MainWindow(filename);
                jeu.Show();

            }
        }

      

    }
}
